package cn.johnyu.provider;

import cn.johnyu.commons.Greeter;
import cn.johnyu.provider.service.impl.GreeterImpl;
import org.apache.dubbo.config.ProtocolConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.ServiceConfig;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;

public class ProviderApp {
    public static void main(String[] args) throws Exception{
        GreeterImpl greeter = new GreeterImpl();
        ServiceConfig<Greeter> config = new ServiceConfig<>();
        config.setInterface(Greeter.class);
        config.setRef(greeter);

        DubboBootstrap.getInstance()
                .application("provider")
                .service(config)
                .protocol(new ProtocolConfig("tri",-1))
                .registry(new RegistryConfig("nacos://localhost:8848"))
                .start();

        System.in.read();
    }
}
